package com.xxwy.segmenttree.practice;

import com.xxwy.segmenttree.Meager;
import com.xxwy.segmenttree.SegmentTree;

import javax.swing.text.Segment;

/**
 * @author xxwy
 */
public class Main {

    public static void main(String[] args) {
        Integer[] nums = {1, 2, 3, 4, 5, 6, 7, 8};
        //最大值
        SegmentTree<Integer> tree = new SegmentTree<>(nums, (Meager<Integer>) (a, b) -> a+b);
        System.out.println(tree.query(0,3));
        System.out.println(tree.query(2,5));
    }
}
